package com.yingwei.mining.appletversion;

public class Route
{
    Edge[] edges;
    GraphPanel graphPanel;
    Route(GraphPanel graphPanel)
    {
	this.graphPanel = graphPanel;
    }
    public int getDistance()
    {
	int len = 0;
	for( int i=0;i<edges.length;i++)
	{
	    len += edges[i].len;
	}
	return len;
    }
    public Excavator getExcavator()
    {
	Device d = graphPanel.nodes[edges[0].from].device;
	return (Excavator)d;
    }
    public UnloadArea getUnloadArea()
    {
	Device d = graphPanel.nodes[edges[edges.length -1].to].device;
	return (UnloadArea)d;
    }
}
